//
//  FFCommons.swift
//  Health_Infomation
//
//  Created by 林帆 on 2017/8/17.
//  Copyright © 2017年 林帆. All rights reserved.
//

import UIKit

// MARK: - 尺寸信息

/// 全屏宽度
let kScreenWitdh = UIScreen.main.bounds.width
/// 全屏高度，不含状态栏高度
let kScreenHeight = UIScreen.main.bounds.height
/// 全屏高度，含状态栏高度
let kAllHeight = (UIScreen.main.bounds.size.height + 20.0)
/// 视图控制器高度，不含导航栏控制器高度
let kBodyHeight = (UIScreen.main.bounds.size.height - 44.0)
/// tabbar切换视图控制器高度
let kTabbarHeight = 49.0
/// 搜索视图高度
let kSearchBarHeight = 45.0
/// 状态栏高度
let kStatusBarHeight = 20.0
/// 导航栏高度
let kNavigationHeight = 44.0
/// 导航栏加状态栏高度
let kTopUsuallyHeight = 64.0


// 当前系统版本
let  version = (UIDevice.current.systemVersion as NSString).floatValue

// NSUserDefault
let userDefault = UserDefaults.standard
// 通知中心
let notice = NotificationCenter.default
////判断字符串是否为空
//func trimString(str:String)->String{
//    var nowStr = str.stringByTrimmingCharactersInSet(NSCharacterSet.whitespaceCharacterSet())
//    return nowStr
//}

func RGBA (r:CGFloat, g:CGFloat, b:CGFloat, a:CGFloat) -> UIColor
{
    return UIColor(red: r/255.0, green: g/255.0, blue: b/255.0, alpha: a)
}

func kRGBColorFromHex(rgbValue: Int) -> (UIColor) {
    return UIColor(red: ((CGFloat)((rgbValue & 0xFF0000) >> 16)) / 255.0,
                   green: ((CGFloat)((rgbValue & 0xFF00) >> 8)) / 255.0,
                   blue: ((CGFloat)(rgbValue & 0xFF)) / 255.0,
                   alpha: 1.0)
}

public func fftextSize(text : String , font : UIFont , maxSize : CGSize) -> CGSize{
    return text.boundingRect(with: maxSize, options: [.usesLineFragmentOrigin], attributes: [NSFontAttributeName : font], context: nil).size
}

func MGLog(_ message:Any..., file:String = #file, function:String = #function,
           line:Int = #line) {
    #if DEBUG
        //获取文件名
        let fileName = (file as NSString).lastPathComponent
        //打印日志内容
        print("\(fileName):\(line) 方法：\(function) 信息：\(message)")
    #endif
}






